home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 2 / BBS in a box - Trilogy II.iso / Files / Newton / Bus / CheckPlease! 1.1 / Project Data < prev    next >
Encoding:
Text File  |  1993-11-03  |  2.5 KB  |  85 lines  |  [TEXT/NTP1]

  1. //---------------------------------------------------------------------------------
  2. //    Temporary work-around to get sound resources into NTK projects.
  3. //
  4. //    To use this you must do the following in your NTK project "Project Data" file:
  5. //
  6. //    Define the constant "pathName" as a text string of the path to the
  7. //    resource file that contains the sound resources you wish to use.
  8. //    Note that this path can be either a full path name or a path relative
  9. //    to your NTK Toolkit folder.
  10. //
  11. //    Example:
  12. //        constant pathName := ":myProject:sounds.rsrc"
  13. //
  14. //    Now you can define slots of type "evaluate" and play them like so:
  15. //        mySound := GetSound11( pathName, "boing" );
  16. //        PlaySound( mySound );
  17. //
  18. //    Discovered the hard way by:
  19. //        Allan Hoeltje
  20. //        Boulder, Colorado  USA
  21. //        303-444-2204
  22. //        August 1993
  23.  
  24. constant pathName := "Delicious:newt:allan's projects:CheckPlease!:OnOffButton.rsrc";
  25.  
  26. constant kPackageName := "CheckPlease:ALH";
  27. constant kAppSymbol := '|CheckPlease:ALH|;
  28.  
  29. //constant kNone    := 0;
  30. //constant k8Bit    := 1;
  31. //constant kFloat11kRate    := 11013.21586;
  32. //constant kFloat22kRate    := 22026.43172;
  33.  
  34. RemoveScript := func( partName )
  35.     begin
  36.     //    If the user removes us then also remove our application options in the system soup.
  37.  
  38.     //    I am not sure we should do this.  The user may have installed the app on a card and
  39.     //    may want to swap cards.  Too bad removing the card calls RemoveScript!  Maybe
  40.     //    someday there will be a RemoveAppScript() and a RemoveCardScript()?
  41.  
  42.     //local s := GetStores()[0]:GetSoup( ROM_SystemSoupName );
  43.   //local c := Query( s, {type: 'index, indexPath: 'tag, startKey: kPackageName} );
  44.  
  45.   //appOpts := c:Entry();
  46.   //if appOpts and StrEqual( appOpts.tag, kPackageName ) then
  47.   //      EntryRemoveFromSoup( appOpts );
  48. end;
  49.  
  50.  
  51. func myGetSound22( file, name )
  52.     begin
  53.     local rsrcFile    := OpenResFileX( file );
  54.     local sndFrame    :=
  55.         {
  56.         sndFrameType:        'simpleSound,
  57.         samples:            GetSndAsSamples( name ),
  58.         samplingRate:        kFloat22kRate,
  59.         dataType:            k8Bit,
  60.         compressionType:    kNone
  61.         };
  62.     CloseResFileX( rsrcFile );
  63.     return sndFrame;
  64.     end;
  65.  
  66.  
  67. func myGetSound11( file, name )
  68.     begin
  69.     local rsrcFile    := OpenResFileX( file );
  70.     local sndFrame    :=
  71.         {
  72.         sndFrameType:        'simpleSound,
  73.         samples:            GetSndAsSamplesRate11KHz( name ),
  74.         samplingRate:        kFloat11kRate,
  75.         dataType:            k8Bit,
  76.         compressionType:    kNone
  77.         };
  78.     CloseResFileX( rsrcFile );
  79.     return sndFrame;
  80.     end;
  81.  
  82. btnSnd := myGetSound11( pathName, "buttonSound" );
  83.  
  84. //---------------------------------------------------------------------------------
  85.